1. Field of the Invention
The present invention generally relates to data structures for storing an amount of data, and more particularly, to universal disk format (UDF) data structures capable of storing an amount of data that is variable in size.
2. Description of the Related Art
Optical media are storage media that hold content in digital form and that are written to and read from by a laser. Optical media include the CD variations, such as CD-ROMs, CD-Rs, CD-R/Ws, as well as the DVD variations, such as DVD-ROMs, DVD-Rs, DVD-R/Ws and DVD-RAMs. Optical media have a number of advantages over magnetic media such as the floppy disk. Optical media currently have a capacity range of over 6 GB compared to 1.44 MB of a floppy disk. Durability is another feature of optical media. An optical disk typically lasts much longer than a magnetic media.
Due to the large variety of optical media, the large number of different manufacturers of optical media drives, and the different types of systems (from DVD players to different computing system platforms) that must access data stored on optical media, compatibility is a concern. To address this concern, the Optical Storage Technology Association (OSTA), a non-profit trade association actively promoting the use of writable optical technologies and products for storage of computer data and images, created the Universal Disk Format (UDF). UDF is a universal vendor-independent file system designed for data interchange and portability allowing an operating system to access (read/write/modify) data that was created by another operating system. It is a subset of an International Standards Organization (ISO) interchange standard for non-sequential recording of data, known as ISO 13346. UDF was developed by the OSTA as a means of ensuring consistency among data written to various optical media.
FIG. 1 illustrates an exemplary UDF data structure 100 which generally includes a header 110 and user data 120. As illustrated, the user data 120 may include data stored as files 122_1 to 122_N, each of which may span several sectors (124_1 to 124_M). Generally, a sector refers to the smallest accessible amount of storage on the medium, which is typically 2 kB for UDF data. Typically, files are assigned sequentially numbered sectors, to improve performance (i.e., access time). A UDF data structure may include files of the same type, such as video files of a movie stored on a DVD, as well as files of different types. For example, a DVD manufacturer or publisher may provide image files, for use as screensavers or wallpaper, along with video files of a movie, as an added bonus to the movie.
The header 110 is an architected descriptor generally containing an ID field 112, a bitmap size field 114, a freespace bitmap field 116 and various other structures 118. The other structures 118 may include various architected descriptors that contain information about the identification, attributes, and organization of the physical and logical volume of the data structure 100, as well as directory structure and files associated with the volume. Examples of other structures include a primary volume descriptor, logical volume descriptor, logical volume integrity descriptor, partition descriptor, file set descriptor, file identifier descriptor, and information control block.
The bitmap size field 114 indicates a size, in bytes, of the freespace bitmap field 116. The freespace bit-map field includes one bit to indicate the status of each sector on the media the file system can use. The possible values for the bits are “available” or “in-use”. When an application is attempting to write to the media (e.g., directory information, user data, etc.) the file system goes to the freespace bitmap field 116 and finds the required number of sectors that are available on the media. Prior to writing on those sectors, corresponding bits in the freespace bitmap field 116 are changed (to “in-use”) to indicate to a subsequent application the sectors are not available for writing data. Because each bit of the freespace bitmap field 116 represents one sector of the media, once the header is written to the media (i.e., the media is formatted for UDF), the size of the data amount is fixed. To increase the amount represented would require expansion of the freespace bitmap field 116, which would result in an associated expansion of the header 110 into the user data 120. As a result of this limitation, a number of difficulties arise when manipulating UDF data.
For example, one difficulty arises when attempting to copy an amount of UDF data from a source medium to a target medium of greater capacity (e.g., copying from a CD-ROM to a DVD RAM). Methods for copying an amount of UDF data generally fall into two categories: sector copying and file copying. Sector copying generally includes initializing the first sector address and reading sectors of data from the source and writing sectors of data to the target from the first sector to the last. Because sectors of data are accessed sequentially and only once, sector copying is generally fast and efficient. However, sector copying is typically limited to source and target media of the same capacity and same sector size. This is because sector copying routines typically copy all the sectors (including file system with information specifying media capacity) from the source medium to the target medium sequentially, beginning with the first sector. In other words, the copied media capacity information will be inconsistent with the actual capacity of the target medium.
File copying, on the other hand, is not limited to source and target media of the same capacity and sector size. File copying generally includes identifying a first file to be copied from the source medium, opening the file on the source medium for reading, opening a file on the target medium for writing and copying data from the file on the source medium to the file on the target medium (media capacity information is not copied). Once all the data is copied, the files are closed on the source and the target media. However, the seemingly simple operations of opening and closing the files on the source and target media involve traversing a file system directory structure to access files scattered across the source and target media. Accordingly, this approach may suffer a disadvantage in performance when compared to sector copying, and is generally unacceptable for copying a large number of files.
Another difficulty that arises as a result of a UDF data structure having a fixed capacity occurs when a user creates a virtual media using the UDF. In general, a virtual medium has the quality of appearing to be one type of medium while residing on another type of medium. For example, a user may create a virtual UDF medium on a direct access storage device (DASD), such as a hard drive. The virtual UDF medium may appear to the user as a regular physical medium (e.g., a DVD), allowing the user to access (e.g., play, record, and/or edit) the virtual medium using familiar applications. However, the user may gain a performance advantage working with the virtual medium because the DASD may have faster access times (e.g., read, write, and seek times) than a drive used to access the physical medium.
While the user may want the ability to handle virtual media of the same size as the physical media it represents (e.g., a 4.7 GB DVD), the user may also want to minimize the amount of storage space required on the DASD. For example, the user may not want to tie up 4.7 GB of storage space on the DASD to store 5 MB of data on a relatively small virtual UDF media. However, the user may want the capacity of the virtual UDF media to grow to hold up to the real 4.7 GB if the user has more data to put on this virtual medium. As previously described, however, the capacity of UDF media is typically fixed once the media is formatted and the freespace bitmap field 116 is written. Because each bit of the freespace bitmap field 116 represents a sector of the user data 120, the freespace bitmap field 116 would have to be expanded to represent a larger amount of data. However, if the freespace bitmap field 116 is expanded, the header 110 will be expanded accordingly, and may extend into the user data 120. Therefore, the user data 120 would have to be moved to make room for the expanded header 110, which may require time consuming complex copying operations.
Accordingly, there is a need for an improved method for creating and manipulating UDF data structures having a variable capacity.